package com.community.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.community.entity.ParkingInmanage;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * (ParkingInmanage)表数据库访问层
 *
 * @author makejava
 * @since 2021-11-10 09:24:34
 */
public interface ParkingInmanageDao extends BaseMapper<ParkingInmanage> {
    @Select("select id,car_number,in_data,TIMESTAMPDIFF(HOUR, in_data, NOW()) as `hours`\n" +
            ",`status`,car_type,parking from parking_inManage")
    List<ParkingInmanage> selectAll();

    @Select("SELECT * FROM `parking_inmanage`  WHERE car_number = #{licenseplate} ORDER BY in_data \n" +
            "DESC LIMIT 1")
    ParkingInmanage selectByLicenseplate(String licenseplate);
}

